from django.urls import path

from tools.views.test import test
from tools.views.test_order import order
from tools.views.test_task import task
from tools.views.testdepart import depart
from tools.views.testuser import user, account
from tools.views.testpretty import pretty
from tools.views.testadmin import admin
from tools.views.webscan import data_collection_whitelist
from tools.views.testing import product

urlpatterns = [

    # path('', views.index, name='index'),
    # 添加其他URL模式

    # ########## test ##########

    # https://www.xxx.com/index  ->  函数
    path('index/', test.index, name='index'),
    path('userinfo/list/', test.user_list, name='userlist'),
    path('userinfo/add/', test.user_add, name='useradd'),

    path('tpl/', test.tpl, name='tools_userinfo展示数据'),
    path('news/', test.news, name='联通新闻中心'),
    # path('orm/', test.orm, name='tools_userinfo添加数据'),
    path('info/list/', test.info_list, name='用户列表'),
    path('info/add/', test.info_add, name='添加用户'),


    # ########## depart ##########

    # 查询部门
    path('depart/list/', depart.depart_list, name='查询部门'),
    # 新增部门
    path('depart/add/', depart.depart_add, name='新增部门'),
    # 删除部门
    path('depart/delete/', depart.depart_delete, name='删除部门'),
    # 修改部门
    # http://localhost:8000/depart/10/edit/
    # http://localhost:8000/depart/2/edit/
    # http://localhost:8000/depart/4/edit/
    path('depart/<int:nid>/edit/', depart.depart_edit, name='修改部门'),


    # ########## user ##########

    # 查询用户
    path('user/list/', user.user_list, name='查询用户'),
    # 新增用户
    path('user/add/', user.user_add, name='新增用户'),

    # 新增用户ModeForm版本
    path('user/model/form/add/', user.user_model_form_add, name='新增用户ModeForm版本'),
    path('user/<int:nid>/edit/', user.user_edit, name='修改用户ModeForm版本'),
    path('user/<int:nid>/delete/', user.user_delete, name='删除用户ModeForm版本'),


    # ########## pretty ##########

    # 靓号管理
    path('prettynum/list/', pretty.prettynum_list, name='靓号管理'),
    path('pretty/list/', pretty.pretty_list, name='靓号管理'),
    # 新增靓号
    path('prettynum/add/', pretty.prettynum_add, name='新增靓号'),
    path('prettynum/<int:nid>/edit/', pretty.pretty_edit, name='修改靓号'),
    path('prettynum/<int:nid>/delete/', pretty.prettynum_delete, name='删除靓号'),

    # 管理员管理
    path('admin/list/', admin.admin_list),
    path('admin/add/', admin.admin_add),
    path('admin/<int:nid>/edit/', admin.admin_edit),
    path('admin/<int:nid>/delete/', admin.admin_delete),
    path('admin/<int:nid>/reset/', admin.admin_reset),

    # 登录
    path('login/', account.login, name='login'),
    path('logout/', account.logout, name='logout'),
    path('image/code/', account.image_code, name='image_code'),

    # 任务管理
    path('task/list/all/', task.task_list_all, name='task_list_all'),
    path('task/list/add/', task.task_list_add, name='task_list_add'),
    path('task/<int:nid>/edit/', task.task_edit, name='task_edit'),
    path('task/<int:nid>/delete/', task.task_delete, name='task_delete'),
    # path('task/delete/', task.task_delete, name='删除任务'),
    # path('task/batch_delete/', task.batch_delete_tasks, name='task_batch_delete'),
    path('task/ajax/', task.task_ajax, name='task_ajax'),

    # 订单管理
    path('order/list/', order.order_list, name='order_list'),
    path('order/add/', order.order_add, name='order_add'),
    path('order/ajax/add/', order.order_ajax_add, name='order_ajax_add'),
    path('order/<int:nid>/edit/', order.order_edit, name='order_edit'),
    path('order/<int:nid>/delete/', order.order_delete, name='order_delete'),

    path('orders/', order.orders_list, name='orders_list'),
    path('orders/add/', order.orders_add, name='orders_add'),
    path('orders/data/', order.orders_list_data, name='orders_list_data'),

    path('order/index/', order.order_index, name='order_index'),
    path('order/search/', order.order_search, name='order_search'),

    # 白名单配置
    path('white/index/', data_collection_whitelist.index, name='index_data_collection_whitelist'),
    path('white/search/', data_collection_whitelist.search_data_collection_whitelist, name='search_data_collection_whitelist'),
    path('white/add/', data_collection_whitelist.insert_data_collection_whitelist, name='insert_data_collection_whitelist'),
    # path('white/search/byid', data_collection_whitelist.search_data_collection_whitelist_byid, name='search_data_collection_whitelist_byid'),
    # path('white/edit/', data_collection_whitelist.update_data_collection_whitelist, name='update_data_collection_whitelist'),
    # path('white/delete/', data_collection_whitelist.delete_data_collection_whitelist, name='delete_data_collection_whitelist'),



    # path('product/search/', product.product_search, name='product_search'),


    # path('product_list', product.product_list, name='product_list'),
    # path('product/search2/', product.search_products, name='search_products'),
    # path('product/add/', product.add_product, name='add_product'),  # 新增产品的URL
    # path('product/edit/<int:id>/', product.edit_product, name='edit_product'),  # 修改产品的URL
    path('product/list/', product.product_list, name='product_list'),
    path('product/search/', product.search_products, name='search_products'),
    path('product/add/', product.add_product, name='add_product'),
    path('product/edit/<int:product_id>/', product.edit_product, name='edit_product'),
    path('product/delete/<int:product_id>/', product.delete_product, name='delete_product'),
]
